package com.brillilab.service.module.message.template.impl.topic;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

/**
 * @author zlb
 * @Title: TargetToIsNotMemberRecoverTemp
 * @ProjectName brill_lab
 * @Description: 实验目标被非对应的执行成员恢复
 * @date 2019/5/28 9:44
 */
@Data
public class TargetToIsNotMemberRecoverTemp extends AbstractMessageTemplate {
    private String targetName;
    private String operatorName;
//    private Long experimentTargetId;
//    private Long executorId;
    /**
     * 课题ID
     */
    private Long topicId;
    /**
     * 课题状态
     */
    private Integer topicState;
    /**
     * 研究内容ID
     */
    private Long topicDirectionId;
    /**
     * 课题目标ID
     */
    private Long topicTargetId;


    /**
     * 实验目标被非对应的执行成员恢复
     *
     * @param labId        实验室ID
     * @param receiverId   接收人ID
     * @param labMemberId  接收者实验室成员Id
     * @param targetName   实验目标名称
     * @param operatorName 操作人姓名
     * @param referId      业务关联ID
     */
    public TargetToIsNotMemberRecoverTemp(Long labId,Long receiverId,Long labMemberId,String targetName,String operatorName,Long referId,Integer topicState,Long topicDirectionId,Long topicTargetId) {
        super(labId,receiverId);
        super.setType(MessageTypeEnum.TargetToIsNotMemberRecover.getValue());
        super.setTitle("实验目标已被恢复");
        String content=String.format("" +
                        "<span style='color:#F6AC2D'>%s</span>" + "<span>已被</span>" +
                        "<span style='color:#F6AC2D'>%s</span>" + "<span>恢复为可执行</span>"
                ,targetName,operatorName);
        super.setContent(content);
        super.setAppContent(String.format("%s已被%s恢复为可执行",targetName,operatorName));
        this.labMemberId=labMemberId;
        this.targetName=targetName;
        this.operatorName=operatorName;
        this.referId=referId;
//        this.executorId=labMemberId;
//        this.experimentTargetId=referId;
        this.topicState=topicState;
        this.topicId=referId;
        this.topicDirectionId=topicDirectionId;
        this.topicTargetId=topicTargetId;
    }

    @Override
    public String getJsonData() {
        JSONObject object=new JSONObject();
//        object.put("experimentTargetId",experimentTargetId);
//        object.put("executorId",executorId);
        object.put("topicId", topicId);
        object.put("topicDirectionId", topicDirectionId);
        object.put("topicState", topicState);
        object.put("topicTargetId", topicTargetId);
        object.put("content",appContent);//app推送需必须加入此参数
        return object.toJSONString();
    }

}
